package com.feeyo.groundservice.recordnfc.activity

import android.content.pm.ActivityInfo
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.blankj.utilcode.util.BarUtils
import com.feeyo.groundservice.base_util.clearScreeOn
import com.feeyo.groundservice.base_util.getColor
import com.feeyo.groundservice.base_util.keepScreenOn
import com.feeyo.groundservice.recordnfc.R
import com.therouter.TheRouter

/**
 *作者：70893 on 2025-10-07
 *描述：录卡通用基类
 */
internal abstract class BaseRecordCardActivity: AppCompatActivity() {
    protected val TAG = javaClass.simpleName

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setStatusBar()
        keepScreenOn()
        TheRouter.inject(this)//参数自动注入
        requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT//竖屏
    }

    override fun onDestroy() {
        super.onDestroy()
        clearScreeOn()
    }

    //针对compose使用
    open fun onBack() = finish()

    /**设置状态栏**/
    private fun setStatusBar() {
        BarUtils.setStatusBarColor(this, R.color.blue_main_2E76EE.getColor(), true)
        BarUtils.setStatusBarLightMode(this, false)
    }

    /**处理特殊的状态栏颜色**/
    fun setStatusBarColor(color: Int, isLightMode: Boolean) {
        BarUtils.setStatusBarColor(this, color, true)
        BarUtils.setStatusBarLightMode(this, isLightMode)
    }
}